import Vue from 'vue'
//导入需要的组件
import {
    Message,
    MessageBox,
    Form,
    FormItem,
    Button,
    Select,
    Checkbox,
    CheckboxGroup,
    TimePicker,
    DatePicker,
    col,
    Switch,
    Input,
    Radio,
    RadioGroup,
    Option
} from 'element-ui'

//这里放注册组件
let useObj = {
    Form,
    FormItem,
    Button,
    Select,
    Checkbox,
    CheckboxGroup,
    TimePicker,
    DatePicker,
    col,
    Switch,
    Input,
    Radio,
    RadioGroup,
    Option
}
//这里放挂载方法
let prototypeObj = {
    MessageBox,
    Alert:MessageBox.alert,
    Message
}

function VueComponent() {
    console.log(useObj)
    for (let x in useObj) {
        Vue.use(useObj[x]);
    }

}
function VuePrototype(){
    for (let x in prototypeObj){
        //将首字母转化为小写
        let str=x.slice(0,1).toLowerCase()+x.slice(1)
        //挂载到Vue原型上
        Vue.prototype[`$${str}`]= prototypeObj[x];
    }
    
}

//导出方法
export function elementFunction() {
    VueComponent()
    VuePrototype()
}